<?php 
require_once('Connections/tecno.php'); 
session_start();
if(isset($_REQUEST['selectBanco'])){$id = $_REQUEST['selectBanco'];}else{$id = 2;}

mysql_select_db($database_tecno, $tecno);
$detalle = mysql_query("SELECT * FROM bancodt, bancos WHERE bancodt.idBanco = '$id' AND bancos.codBanco = bancodt.idBanco") or die(mysql_error());
$row_detalle = mysql_fetch_assoc($detalle);
$totalRows_detalle = mysql_num_rows($detalle);

$debito = mysql_query("SELECT SUM(monto) as debito FROM bancodt, bancos WHERE bancodt.idBanco = '$id' AND bancos.codBanco = bancodt.idBanco AND bancodt.tipo = 2") or die(mysql_error());
$row_debito = mysql_fetch_assoc($debito);
$totalRows_debito = mysql_num_rows($debito);

$credito = mysql_query("SELECT SUM(monto) as credito FROM bancodt, bancos WHERE bancodt.idBanco = '$id' AND bancos.codBanco = bancodt.idBanco AND bancodt.tipo = 0") or die(mysql_error());
$row_credito = mysql_fetch_assoc($credito);
$totalRows_credito = mysql_num_rows($credito);

if($totalRows_detalle>0){
?>
<table cellspacing="3" width="500px">
<tr>
		<td class='tituloTabla'>Banco</td>
		<td class='tituloTabla'>D&eacute;bito</td>
        <td class='tituloTabla'>Cr&eacute;dito</td>
</tr>
   
<tr class="rowTabla">      
        <td style="text-align:left;"><?php echo $row_detalle['banco']; ?></td>
        <td style="text-align:center;"><?php echo $row_debito['debito']; ?></td>  
        <td style="text-align:center;"><?php echo $row_credito['credito']; ?>
          
        </td>        
</tr>
</table>
<?php }else{echo 'El banco seleccionado no tiene registros';}?>